package server.core;

import lombok.Data;

@Data
public class Engine {

    ServiceMapper serviceMapper;
    public void init(ServiceMapper serviceMapper) {
        this.serviceMapper = serviceMapper;
        for (Host host : serviceMapper.getHostList()) {
            host.init();
        }
        serviceMapper.getConnector().init(serviceMapper.getHostList());
    }

    public void start() {
        serviceMapper.getConnector().start();
        for (Host host : serviceMapper.getHostList()) {
            host.start();
        }
    }
}
